const http = require('http')
const fs = require('fs')
http.createServer((request, response) => {
    // console.log('request come', request.url)
    console.log('request come', request.headers)

    if (request.url === '/') {
        const html = fs.readFileSync('text.html')
        response.writeHead(200, {
            'Content-Type': 'text/html',
            // 'Content-Security-Policy': 'default-src http: https:'
            // 'Content-Security-Policy': 'default-src \'self\''
            // 'Content-Security-Policy': 'default-src \'self\' http://code.jquery.com'
            // 'Content-Security-Policy': 'default-src \'self\'; form-action \'self\''
            // 'Content-Security-Policy': 'default-src \'self\'; form-action \'self\'; report-uri /report'
            // 'Content-Security-Policy-Report-Only': 'default-src \'self\'; form-action \'self\'; report-uri /report'
        })
        response.end(html)
    } else {
        response.writeHead(200, {
            'Content-Type': 'application/javascript'
        })
        response.end('console.log("loaded script")')
    }

}).listen(8888)
console.log('server listening on 8888')

